<?php
class openAction extends baseAction{

	public function getReport(){
		$users_mod = D("ju_users");
		
		$user = $users_mod->where("user_name='".$GLOBALS['userName']."'")->find();
		print_r($user);
		$c = $this->taobao_client();
		$req = $c->load_api('TaobaokeReportGetRequest');
		$req->setFields("trade_parent_id,trade_id,real_pay_fee,commission_rate,commission,outer_code,pay_time,pay_price,num_iid,item_num,seller_nick,item_title,outer_code");
		$req->setDate("20121201");
		if($_GET['date']!=''){
			$req->setDate($_GET['date']);
		}
		
		$req->setPageNo(1);
		$req->setPageSize(40);
		$resp = $c->execute($req, $user['access_token']);
		
		$resp = $this->object_array($resp);
		//$resp = (array)$resp[item];
		print_r( $resp);	
		
	}
	public function object_array($array){
		if(is_object($array)){
			$array = (array)$array;
		}
		if(is_array($array)){
			foreach($array as $key=>$value){
				$array[$key] = $this->object_array($value);
			}
		}
		return $array;
	}
}
?>